﻿<?php //Seyret Component v.0.3//
/**
* @package Seyret
* @version 0.3
* @copyright Copyright (C) 2008 Mustafa DINDAR. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* Seyret Video Component is a free software.
* See seyrettos.html for license notices and details.
*/

// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );

$document = & JFactory::getDocument();
$csslink=JURI :: root()."components/com_seyret/themes/default/style/default.seyret.css";
$document->addStyleSheet($csslink);

$jslink=JURI :: root()."components/com_seyret/includes/js/jquery-1.3.2.min.js";
$document->addScript($jslink);

$session =& JFactory::getSession();
$seyretmessage=$session->get('seyret.message');
$seyretmessagetype=$session->get('seyret.messagetype');
$session->clear('seyret.message');
$session->clear('seyret.messagetype');


$user =& JFactory::getUser();

?>



<style>

body {
background-color: white;
}
</style>


<div class="<?php echo $seyretmessagetype;?>">
<?php echo $seyretmessage;?>
</div>

 <script type="text/javascript">

function validate_form(thisform)
{
	with (thisform)
	{
		 
		if (jQuery('#captcha').attr('value')=='') {
			jQuery('#captcha').removeClass('seyretinputbox').addClass('redseyretinputbox');
			var returnvalue='false';
		} else {
			jQuery('#captcha').removeClass('redseyretinputbox').addClass('seyretinputbox');
		}


		if (jQuery('#useremail').attr('value')=='' || validateEmail(jQuery('#useremail').attr('value'))==false) {
			jQuery('#useremail').removeClass('seyretinputbox').addClass('redseyretinputbox');
			var returnvalue='false';
		} else {
			jQuery('#useremail').removeClass('redseyretinputbox').addClass('seyretinputbox');
		}

		

		if (jQuery('#flagreason').attr('value')=='') {
			jQuery('#flagreason').removeClass('seyretinputbox').addClass('redseyretinputbox');
			var returnvalue='false';
		} else {
			jQuery('#flagreason').removeClass('redseyretinputbox').addClass('seyretinputbox');
		}	

		if (jQuery('#flagdetails').attr('value')=='') {
			jQuery('#flagdetails').removeClass('seyretinputbox').addClass('redseyretinputbox');
			var returnvalue='false';
		} else {
			jQuery('#flagdetails').removeClass('redseyretinputbox').addClass('seyretinputbox');
		}			
	
	}
	
	
	if (returnvalue=="false") {
		return false;
	}
}


function validateEmail(elementValue){
	var emailPattern = /^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i ; 
	return emailPattern.test(elementValue); 
} 

</script>




<div id="flagForm" >
	<div style="padding:10px;">
	
<?php

//--------------------------- FLAG VIDEO FORM -------------------START
if ($this->registry->getValue('permission.access.canflagvideos')=="1"){
//check registry
?>



		<form id="flagvideoform" action="index2.php?option=com_seyret&view=tools&task=flagvideosubmit" method="post"  onsubmit="return validate_form(this)">

		<div class="flagvideolabel"><?php echo JText::_('Video Id');?></div>
		<div class="flagvideoinput"><input type="text" name="videoid" id="videoid" class="seyretinputbox flaginputbox"  readonly="readonly" value="<?php echo Jrequest::getVar( 'vid', '', 'get' ); ?>"></div>
		<div style="clear:both;"></div>	

		
		<div class="flagvideolabel"><?php echo JText::_('Video Title');?></div>
		<div class="flagvideoinput"><input type="text" name="videotitle_js" id="videotitle_js" class="seyretinputbox flaginputbox" readonly="readonly" value="<?php echo Jrequest::getVar( 'title', '', 'get' ); ?>"></div>
		<div style="clear:both;"></div>		
		
		<div class="flagvideolabel"><?php echo JText::_('Your Email');?></div>
		<div class="flagvideoinput"><input type="text" name="useremail" id="useremail" class="seyretinputbox flaginputbox" value="<?php echo $user->email;?>"></div>
		<div style="clear:both;"></div>
		
		<div class="flagvideolabel"><?php echo JText::_('Report Reason');?></div>
		<div class="flagvideoinput"><input type="text" name="flagreason" id="flagreason" class="seyretinputbox flaginputbox" value=""></div>
		
		<div class="flagvideolabel"><?php echo JText::_('Report Details');?></div>
		<div class="flagvideoinput"><textarea rows="3" cols="30" name="flagdetails" id="flagdetails" class="seyretinputbox flaginputbox" ></textarea></div>		
		
		
<?php

		//--------------------------- CAPTCHA -------------------START
		if ($this->registry->getValue('permission.access.flagvideoscaptcha')=="1"){
		//check registry
?>
		<div style="text-align:center;"><?php echo $this->recaptcha; ?></div>

<?php
		//--------------------------- CAPTCHA -------------------END
		}

?>
		
		<div style="text-align:center; padding:5px;"><input type="submit" name="button" id="submitter" value="<?php echo JText::_('Send');?>"/></div>
		
		
		
		</form>

<?php
		//--------------------------- SEND TO FRIEND FORM -------------------END
		} else {
		?>
		
		<div class="emaildonthaverights"><?php echo JText::_("You dont have rights to flag videos");?></div>
		<div  class="emaildonthaverights"><img src="<?php echo JURI::root()."components/com_seyret/themes/default/images/notallowed.png"?>" /></div>
		
		
		<?php
		}

?>	
		
	</div>
</div>